package com.sistema.venda;

import org.apache.catalina.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static final SessionFactory sessao = sessionFactory();

	private static SessionFactory sessionFactory() {
		try{
			Configuration cfg = new Configuration();
			cfg.configure();
			return cfg.buildSessionFactory();			
		}
		catch (Throwable e) {
			System.out.println("Erro ao criar sessao."+ e);
			throw new ExceptionInInitializerError();
		}
	}

	public static SessionFactory getSessao() {
		return sessao;
	}
}
	